#List数据类型API
import redis
pool=redis.ConnectionPool(host="192.168.100.3",port=6379,decode_responses=True)
client=redis.Redis(connection_pool=pool)

#插入
client.lpush("list1","v1","v2","v3")
client.rpush("list2","v11","v22","v33")
#查询
#print(client.lrange("list1",0,-1))
#print(client.lrange("list2",0,-1))
#
#print(client.lpop("list1"))
#print(client.rpop("list2"))
#
#print(client.lrange("list1",0,-1))
#print(client.lrange("list2",0,-1))
##查询插入
#client.rpoplpush("list1","list2")
#print(client.lrange("list1",0,-1))
#print(client.lrange("list2",0,-1))

#根据下标获取元素
#print(client.lindex("list1",1))
##查看列表元素个数
#print(client.llen("list1"))
##指定追加插入操作
#client.linsert("list1","before","v2","v22")
#print(client.lrange("list1",0,-1))

#插入
client.lpush("names","zhangsan","lisi","wangwu","zhangsan")
print(client.lrange("names",0,-1))
#删除
client.lrem("names","zhangsan",2)
print(client.lrange("names",0,-1))

client.lset("names",3,"zhaoliu")
print(client.lrange("names",0,-1))




